package expressions;

import tester.cobertura.Instrument;

/**
 * Title : And
 * 
 * Javadoc Online at : http://www.ccs.neu.edu/home/ada2358/Doc/Satisfiability/index.html
 * @author Adam Blackwell
 * @version 1.0
 * @since April 2nd 2009
 */
@Instrument
public class And extends BE {
  /* Fields */
  private BE left;
  private BE right;  
  
  /**
   * @param left
   * @param right
   */
  public And(BE left, BE right) {
    super();
    this.left = left;
    this.right = right;
  }
  
  @Override public <R> R accept(BEVisitor<R> visit) {
    // TODO Auto-generated method stub
    return visit.forAnd(this.left, this.right);
  }
  
  @Override public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((left == null) ? 0 : left.hashCode());
    result = prime * result + ((right == null) ? 0 : right.hashCode());
    return result;
  }

  @Override public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    And other = (And) obj;
    if (left == null) {
      if (other.left != null)
        return false;
    } else if (!left.equals(other.left))
      return false;
    if (right == null) {
      if (other.right != null)
        return false;
    } else if (!right.equals(other.right))
      return false;
    return true;
  }
}
